<h1><span class="reg_ico"></span><?= lang('label_menu_link_addressbooks'); ?></h1>

<ul class="breadcrumb">
    <li><a href="<?= base_url() ?>"><?= lang('label_home') ?></a></li>
    <li><a href="<?= base_url('user/profile') ?>"><?= lang('label_profile') ?></a></li>
    <li><a href="<?= base_url('addressbook') ?>"><?= lang('label_menu_link_addressbooks') ?></a></li>
    <li><?= lang('label_edit').' ('.$addressbook->name.')'; ?></li>
</ul>


<div class="page">
    <form class="forms inside_1" action="<?php echo current_url() ?>" method="post">


        <div class="text">
            <label><?= lang('label_name') ?>  :</label>
            <samp>
                <input type="text" name="name" value="<?= (form_val('name')) ? form_val('name') : $addressbook->name ?>" >
            </samp>

        </div>

        <div class="select">
            <label><?= lang('label_city') ?> :</label>
            <samp> <select name="city" id="city">
                    <?php foreach ($cities as $ct) { ?>
                        <option value="<?= $ct->id ?>" <?php
                        if (form_val('city') == $ct->id) {
                            echo 'selected';
                        } else {
                            if ($addressbook->cities_id == $ct->id)
                                echo 'selected';
                        } ?>><?= $ct->title ?></option>
                            <?php } ?>
                </select> </samp>
        </div>

        <div class="text">
            <label><?= lang('label_mobile') ?> :</label>
            <samp><input pattern="[0-9]*"   type="number" name="mobile"  value="<?= (form_val('mobile')) ? form_val('mobile') : $addressbook->mobile ?>" > </samp>
        </div>


        <div class="textarea">
            <label><?= lang('label_address') ?> :</label>
            <samp> <textarea cols="60" rows="10" name="address"><?= (form_val('address')) ? form_val('address') : $addressbook->address ?></textarea></samp>

        </div>


        <div class="checkbox">
            <samp>
                <input type="checkbox" name="default" id="default" <?php
                if (isset($addressbook)) {
                    if ($addressbook->default == 'YES')
                        echo 'checked';
                }
                ?> /><label for="default"><?php echo lang('label_default') ?></label>
            </samp>
        </div>

        <div class="submit">
            <input name="submit" value="<?= lang('label_edit') ?>" type="submit"  >
        </div>
        
    </form>
</div>